<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<title></title>
	<meta name="format-detection" content="telephone=no" />
	<link rel="stylesheet" type="text/css" href="../css/api.css" />
	<link rel="stylesheet" type="text/css" href="../css/common.css" />
	<link rel="stylesheet" type="text/css" href="../css/list.css" />
	<style>
		/*.divtab{
		text-align: center;
    padding: 10px 5px;
	}
	.divtab input{
		margin-left: 25px;
		margin-right: 5px;
	}*/
	</style>
	<style type="text/css">
		.contentwrap {
			/*width: 98%;*/
			margin: 0 auto;
			padding: 30px 10px 10px 10px;
		}

		ul {
			list-style: none;
			margin: 0 auto;
	    text-align: center;
	    display: table;
	    padding: 0;
		}

		ul.tab {
			/*border-bottom: 1px solid #ccc;*/
			padding-bottom: 1px;
			height: 30px;
			line-height: 30px;
			color: #696969;
		}

		ul.tab li {
			float: left;
			font-family: "微软雅黑";
			cursor: pointer;
			padding: 0px;
		}

		ul.tab li.li {
			padding: 0px 25px 0px;
			font-size: 12px;
			height: 30px;
			line-height: 30px;
			background: #F4F5F9;
			border-top: 1px solid #C5D0DC;
			border-left: 1px solid #C5D0DC;
			border-bottom: 1px solid #C5D0DC;
		}

		ul.tab li.current {
			/*border: 2px solid #C5D0DC;*/
			/*border-bottom: 2px solid #C5D0DC;*/
			font-size: 16px;
			color: #FFFFFF;
			background: #FFFFFF;
		}
		/*ul.tab li.current span{
			font-size: 15px;
			color: #FFFFFF;
		}*/
		ul.tab li.li:first-child {
			/*border-bottom: 1px solid #C5D0DC;*/
			border-radius: 10px 0px 0px 10px;
		}
		ul.tab li.li:last-child {
			border-right: 1px solid #C5D0DC;
			border-radius: 0px 10px 10px 0px;
		}
	</style>
</head>

<body>
	<!-- <div class='divtab contentwrap'>
			<ul class="tab"  id="divTabInfo">
				<li id="li_stage" class="li current" onclick="toStageInfo()"><span>tab1</span></li>
				<li id="li_class" class="li" onclick="toClaRecordDetail()"><span>tab2</span></li>
				<li id="li_photo" class="li" onclick="toTrainPhoto()"><span>tab3</span></li>
			</ul>
	</div> -->
	<!-- <div class="h10"></div>
	<div id="divTipInfo" style="text-align:center;font-size:14px;color:#999"></div> -->
	<div id="divNoDataTip">
		<div id="textTip" style="margin-top:10px;margin-bottom:10px;width:100%;text-align: center;" class="button red" tapmode="">正在加载....</div>
	</div>
	<iframe id="ccframe" src="" style="border:none;width:100%;height:200vh;">
	</iframe>
	<!-- <div id="main_content"></div> -->

	<!-- <div class="h10"></div> -->
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/alpenlicebe.js"></script>
<script type="text/javascript" src="../script/zepto.min.js"></script>
<script type="text/javascript" src="../script/hashes.min.js"></script>
<script type="text/javascript" src="../script/echarts-all.js"></script>
<script>
	apiready = function() {
		/*下拉刷新*/
		// api.setRefreshHeaderInfo({
		// 	visible: true,
		// 	loadingImg: 'widget://image/refresh.png',
		// 	bgColor: '#fff',
		// 	textColor: '#000',
		// 	textDown: '下拉刷新...',
		// 	textUp: '松开刷新...',
		// 	showTime: true
		// }, function(ret, err) {
		// 	$("#main_content").html("");
		// 	$("#textTip").html("正在加载..");
		// 	goto_loadDataFunNew1();
		// 	api.refreshHeaderLoadDone();
		// });

		/*初始化加载数据*/
		goto_loadDataFunNew1();
	}

  function goto_loadDataFunNew1(){
		var cateID = api.pageParam.cateID;
		var cateName = api.pageParam.cateName;
		var cateInfo = api.pageParam.cateInfo;
		var MD5 = new Hashes.MD5;
		var access_token = Alpe_getLocalStorge("access_token");
		var admin_id = Alpe_getLocalStorge("admin_id");
		var sign = MD5.hex(access_token + admin_id  + 'datas/SdealDataPage1.0syjqingbao');

		var url = Alpe_ApiUrl + 'r=datas/SdealDataPage&access_token=' + access_token + '&admin_id=' + admin_id +
		'&status=sjtj_deal&v=1.0&sign=' + sign;
console.log(url);
		$("#ccframe").attr("src",url);
		$("#divNoDataTip").hide();

	}

	function goto_loadDataFunNew() {
		var userID = Alpe_getLocalStorge('access_token');
		if ('' == userID) {
			api.alert({
				title: '系统提示',
				msg: '您未登录'
			});
			return;
		}
		var cateID = api.pageParam.cateID;
		var cateName = api.pageParam.cateName;
		var cateInfo = api.pageParam.cateInfo;
		if ('' == cateID || undefined == cateID || null == cateID ||
			'' == cateInfo || undefined == cateInfo || null == cateInfo) {
			api.alert({
				title: '系统提示',
				msg: '参数错误'
			});
			return;
		}

		api.showProgress({
			style: 'default',
			animationType: 'fade',
			title: '',
			text: '',
			modal: false
		});

		var MD5 = new Hashes.MD5;
		var access_token = Alpe_getLocalStorge("access_token");
		var admin_id = Alpe_getLocalStorge("admin_id");
		var sign = MD5.hex(access_token + admin_id + cateInfo + '1.0syjqingbao');

		var url = Alpe_ApiUrl + 'r=' + cateInfo + '&access_token=' + access_token + '&admin_id=' + admin_id + '&status=' + cateID +
			'&v=1.0&sign=' + sign;
		console.log(url);
		api.ajax({
			url: url,
			method: 'get',
			cache: false,
			timeout: 30,
			dataType: 'json'
		}, function(ret, err) {
			if (ret) {
				if (ret.success == '100') {
					$("#divTabInfo").html('');
					$.each(ret.menulist, function(idx, v) {
						var cateID = v.id;
						var cateName = v.title;
						var cateInfo = v.remarks;
						if (idx == 0) {
							$("#divTabInfo").append('<li id="li_stage'+cateID+'" class="li_stage li current" onclick="goto_loadNewsListFun(\'' + cateID + '\',\'' + cateName + '\',\'' + cateInfo + '\')"><span>'+cateName+'</span></li>');

							// $("#divTabInfo").append('<input name="selectcheck" type="radio" lang="' + cateInfo + '" value="' + cateID + '" checked="checked" onchange="goto_loadNewsListFun(\'' + cateID + '\',\'' + cateName + '\',\'' + cateInfo + '\')"/>' + cateName);
							goto_loadNewsListFun(cateID, cateName, cateInfo);
						} else {
							$("#divTabInfo").append('<li id="li_stage'+cateID+'" class="li_stage li " onclick="goto_loadNewsListFun(\'' + cateID + '\',\'' + cateName + '\',\'' + cateInfo + '\')"><span>'+cateName+'</span></li>');
							// $("#divTabInfo").append('<input name="selectcheck" type="radio" lang="' + cateInfo + '" value="' + cateID + '"  onchange="goto_loadNewsListFun(\'' + cateID + '\',\'' + cateName + '\',\'' + cateInfo + '\')"/>' + cateName);
						}


					});

				} else if ("002" == ret.success || "003" == ret.success) {
					goto_openWin_loginWin(ret.message);
				} else {
					$("#textTip").html(ret.message);
					api.toast({
						msg: ret.message,
						duration: 2000,
						location: 'middle'
					});
				}
				$("#textTip").html("");
				api.hideProgress();
			} else {
				api.alert({
					title: '系统提示',
					msg: '错误码：' + err.code + '；错误信息：' + err.msg + '网络状态码：' + err.statusCode
				});
				api.hideProgress();
			}
		});
	}


	function goto_loadDataFun() {
		goto_loadNewsListFun();
		api.parseTapmode();
	}

	function goto_loadNewsListFun(cateID, cateName, cateInfo) {
		$(".li_stage").removeClass("current");
		$("#li_stage"+cateID).addClass("current");

		var userID = Alpe_getLocalStorge('access_token');
		if ('' == userID) {
			api.alert({
				title: '系统提示',
				msg: '您未登录'
			});
			return;
		}
		if ('' == cateID || undefined == cateID || null == cateID ||
			'' == cateInfo || undefined == cateInfo || null == cateInfo) {
			api.alert({
				title: '系统提示',
				msg: '参数错误'
			});
			return;
		}

		api.showProgress({
			style: 'default',
			animationType: 'fade',
			title: '',
			text: '',
			modal: false
		});

		var MD5 = new Hashes.MD5;
		var access_token = Alpe_getLocalStorge("access_token");
		var admin_id = Alpe_getLocalStorge("admin_id");
		var sign = MD5.hex(access_token + admin_id + cateInfo + '1.0syjqingbao');

		var url = Alpe_ApiUrl + 'r=' + cateInfo + '&access_token=' + access_token + '&admin_id=' + admin_id +
			'&v=1.0&sign=' + sign;
		console.log(url);
		api.ajax({
			url: url,
			method: 'get',
			cache: false,
			timeout: 30,
			dataType: 'json'
		}, function(ret, err) {
			if (ret) {
				if (ret.success == '100') {
					/*工作考核datas/SkH*/
					if ('100' == cateID) {
						//						$("#divTipInfo").html("本月实时数据");
						goto_tj_table(ret.list, ret.img);
					} else if ('200' == cateID) {
						goto_task_table(ret.list, '单位');
					} else if ('300' == cateID) {
						goto_task_table(ret.list, '姓名');
					} else if ('400' == cateID) {
						goto_tasktype_table(ret.list, '姓名');
					} else {
						if ('datas/SmonitorDatas' == cateInfo) {
							$("#divTipInfo").html("最近一周数据");
							list_statistics_line(ret.x, ret.y);
						} else if ('datas/SdealDatas' == cateInfo) {
							$("#divTipInfo").html("最近半年数据");
							list_statistics_line(ret.weeks_line.months_x, ret.weeks_line.months_y);
						} else if ('datas/SareaDatas' == cateInfo) {
							$("#divTipInfo").html("本月实时数据");
							list_statistics_bar(ret.city_list.x, ret.city_list.y);
						}
					}
				} else if ("002" == ret.success || "003" == ret.success) {
					goto_openWin_loginWin(ret.message);
				} else {
					$("#textTip").html(ret.message);
					api.toast({
						msg: ret.message,
						duration: 2000,
						location: 'middle'
					});
				}
				$("#textTip").html("");
				api.hideProgress();
			} else {
				api.alert({
					title: '系统提示',
					msg: '错误码：' + err.code + '；错误信息：' + err.msg + '网络状态码：' + err.statusCode
				});
				api.hideProgress();
			}
		});
	}

	function list_statistics_bar(x, y) {

		var persons = x.persons;
		var number = eval(x).length;
		var min_number = 6;
		var max_number = 12;
		document.getElementById('main_content').style.height = '100%';
		if (number < 4) {
			document.getElementById('main_content').style.width = '100%';
		} else if (number > 4 && number < 12) {
			document.getElementById('main_content').style.width = '100%';

		} else if (number > 12) {
			document.getElementById('main_content').style.width = '100%';
		}

		var myChart = echarts.init(document.getElementById('main_content'));
		api.showProgress({
			style: 'default',
			animationType: 'fade',
			title: '',
			text: '',
			modal: true
		});
		myChart.setOption({
			tooltip: {
				trigger: 'axis'
			},
			grid: {
				x: 80,
				x2: 25,
				y: 20
			},
			animation:false,
			xAxis: [{
				type: 'value',
				axisLabel: {
					textStyle: {
						fontSize: 10
					}
				}
			}],
			yAxis: [{
				type: 'category',
				splitArea: {
					show: true
				},
				data: x
			}],
			series: [{
				name: '条数',
				type: 'bar',
				data: y
			}]
		});
		api.hideProgress();
		$("#text").html('');
	}

	function list_statistics_line(x, y) {

		var persons = x.persons;
		var number = eval(x).length;
		var min_number = 6;
		var max_number = 12;
		document.getElementById('main_content').style.height = '300px';
		if (number < 4) {
			document.getElementById('main_content').style.width = '100%';
		} else if (number > 4 && number < 12) {
			document.getElementById('main_content').style.width = '100%';

		} else if (number > 12) {
			document.getElementById('main_content').style.width = '100%';
		}
		var myChart = echarts.init(document.getElementById('main_content'));
		api.showProgress({
			style: 'default',
			animationType: 'fade',
			title: '',
			text: '',
			modal: true
		});
		myChart.setOption({
			tooltip: {
				trigger: 'axis'
			},
			grid: {
				x: 35,
				x2: 35,
			},
			animation:false,
			toolbox: {
				show: true,
				feature: {

					magicType: {
						show: true,
						type: ['line', 'bar']
					},

				}
			},
			xAxis: [{
				type: 'category',
				data: x
			}],
			yAxis: [{
				type: 'value',
				splitArea: {
					show: true
				}
			}],
			series: [{
				name: '条数',
				type: 'bar',
				data: y
			}]
		});
		api.hideProgress();
		$("#text").html('');
	}

	function goto_tj_table(dataList, imgList) {
		$("#main_content").html('');
		document.getElementById('main_content').style.width = '100%';
		var html = '<table width="90%" align="center" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000"><tr align="center"><td>单位</td><td>处置中<br />(百分比)</td><td>处置完成<br />(百分比)</td><td>舆情总量</td></tr>';
		$.each(dataList, function(key, value) {
			html += '<tr align="center"><td>' + value.city_name + '</td><td>' + value.count[1][1] + '(' + value.count[1][0] + '%)</td><td>' + value.count[2][1] + '(' + value.count[2][0] + '%)</td><td>' + value.num + '</td></tr>';
		});
		html += '</table>';
		for (img in imgList) {
			html += '<br/>';
			html += "<a onclick=gotoShowPicFun('" + imgList[img] + "')><img src='" + imgList[img] + "' style='width:98%' /> </a>";
		}
		$("#main_content").html(html);
	}

	function goto_task_table(dataList, name) {
		$("#main_content").html('');
		document.getElementById('main_content').style.width = '100%';
		var html = '<table width="90%" align="center" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000"><tr align="center"><td>' + name +
			'</td><td>总计<br /></td><td>发帖<br />(百分比)</td><td>转发<br />(百分比)</td><td>评论<br />(百分比)</td><td>点赞<br />(百分比)</td><td>其他<br />(百分比)</td></tr>';
		$.each(dataList, function(key, value) {
			html += '<tr align="center"><td>' + value.city_name + '</td><td>' + value.total + '</td><td>' + value.fatie + '</td><td>' + value.zhuanfa + '</td><td>' + value.gentie + '</td><td>' + value.dianzan + '</td><td>' + value.baodao + '</td></tr>';
		});
		html += '</table>';
		$("#main_content").html(html);
	}
	function goto_tasktype_table(dataList, name) {
		$("#main_content").html('');
		document.getElementById('main_content').style.width = '100%';
		var html = '<table width="90%" align="center" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000"><tr align="center"><td>单位</td><td>基础网评(次数)<br /></td><td>骨干网评(次数)</td></tr>';
		$.each(dataList, function(key, value) {
			html += '<tr align="center"><td>' + value.city_name + '</td><td>' + value.type1 + '</td><td>' + value.type2 + '</td></tr>';
		});
		html += '</table>';
		$("#main_content").html(html);
	}
	function gotoShowPicFun(pic) {
		if ('ios' == api.systemType) {
			api.openApp({
				iosUrl: pic
			}, function(ret, err) {

			});
		}
		if ('android' == api.systemType) {
			api.openApp({
				androidPkg: 'android.intent.action.VIEW',

				uri: pic
			}, function(ret, err) {});
		}
	}
</script>

</html>
